home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 32 / Amiga Format AFCD32 (Nov 1998, Issue 117).iso / -seriously_amiga- / programming / basic / blitzc2p / demoa040.ascii < prev    next >
Text File  |  1998-08-10  |  12KB  |  653 lines

  1. WBStartup
  2. NoCli
  3.  
  4. #c2pBPLX=320 ; chunky operation width
  5. #c2pBPLY=240 ; chunky operation height
  6. #planeheight=240 ; planar display height, must not be smaller than c2pBPLY
  7. #c2pBPLSIZE=(#c2pBPLX*#planeheight)/8
  8.  
  9. #scrwidth=#c2pBPLX
  10. #scrheight=#c2pBPLY
  11.  
  12. ; DoublePAL 320x200 results on 040/25 25fps including clearscreening c2p (which runs @45.5fps)
  13. ; unmasked ~6000 4x1
  14. ; masked ~5000 4x1
  15. ; unmasked 3300 4x4
  16. ; masked 2600 4x4
  17. ; unmasked 1600 8x8
  18. ; masked 1180 8x8
  19. ; unmasked 600 16x16
  20. ; masked 400 16x16
  21. ; unmasked 200 32x32
  22. ; masked 115 32x32
  23. ; unmasked 45 64x64
  24. ; masked 28 64x64
  25. ; unmasked 11 128x128
  26. ; masked 6.5 128x128
  27.  
  28. ; PAL 320x200 as above
  29. ; unmasked 1660 8x8
  30. ; masked 1200 8x8
  31. ; ummasked 620 16x16
  32. ; masked 415 16x16
  33. ; unmasked 210 32x32
  34. ; masked 116 32x32
  35. ; ummasked 47 64x64
  36. ; masked 28 64x64
  37.  
  38. ; PAL 320x240 as above at 25fps with c2p (@37fps)
  39. ; unmasked 2400 4x4
  40. ; masked 1950 4x4
  41. ; unmasked 1250 8x8
  42. ; masked 900 8x8
  43. ; unmasked 470 16x16
  44. ; masked 300 16x16
  45. ; unmasked 150 32x32
  46. ; masked 85 32x32
  47. ; unmasked 35 64x64
  48. ; masked 20 64x64
  49. ; unmasked 9 128x128
  50. ; masked 5 128x128
  51.  
  52. ; Default is 320x240 with 900 8x8 masked shapes.
  53. ; Can be raised to 1000 8x8 masked shapes with hardcoded xloop
  54. ; Or raised further to nearly 1100 8x8 masked shapes with hardcoded xloop and yloop
  55.  
  56. #iterations=800
  57.  
  58. #objcount=85 ; number of objects (0=none)
  59. #objmasking=1 ; Nonzero=masking
  60.  
  61. #objwidth=32 ; minimum of 8
  62. #objheight=32 ; minimum of 1
  63. #objlongwidth=#objwidth/4
  64.  
  65. #clearscreento=$00000000
  66.  
  67. ; c2p1x1_8_c5_040
  68.  
  69. ; 110% on 040-25
  70.  
  71. Statement c2p040onlyinit{A.l,B.l}
  72. .c2p040onlyinit
  73.   ;A.l=d0=Width.w
  74.   ;B.l=d1=Height.w
  75.  
  76. ; d0.w  chunkyx [chunky-pixels]
  77. ; d1.w  chunkyy [chunky-pixels]
  78. ; d3.w  scroffsy [screen-pixels]
  79.  
  80. c2p1x1_8_c5_040_init
  81.   LEA c2p_datanew(pc),a0
  82.   ANDI.l  #$ffff,d0
  83.   MULU.w  d0,d3
  84.   LSR.l #3,d3
  85.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  86.   MULU.w  d0,d1
  87.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  88. AsmExit
  89. End Statement
  90.  
  91. Statement c2p040only{A.l,B.l}
  92. .c2p040only
  93.   MOVE.l  d0,a0 ; Chunky
  94.   MOVE.l  d1,a1 ; Planar
  95. ; a0  c2pscreen
  96. ; a1  bitplanes
  97.  
  98. c2p1x1_8_c5_040
  99.   MOVEM.l a3-a6,-(a7)
  100.  
  101.   MOVEM.l a0-a1,-(a7)
  102.   LEA c2p_datanew,a0
  103.   LEA c2p_data,a1
  104.   MOVEQ #16-1,d0
  105. _c2pcopy: MOVE.l  (a0)+,(a1)+
  106.   DBF d0,_c2pcopy
  107.   MOVEM.l (a7)+,a0-a1
  108.   MOVE.l  a7,stackstore
  109.   MOVE.l  #clearscreento,a7
  110.   LEA c2p_data(pc),a2
  111.  
  112.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  113.   ADD.l a0,a3
  114.  
  115.   ADD.w #c2pBPLSIZE,a1
  116.   ADD.l c2p_scroffs-c2p_data(a2),a1
  117.   MOVE.l  a1,a2
  118.   ADD.l #c2pBPLSIZE*4,a2
  119.  
  120.   MOVE.l  (a0),d0
  121.   MOVE.l  a7,(a0)+
  122.   MOVE.l  (a0),d1
  123.   MOVE.l  a7,(a0)+
  124.   MOVE.l  (a0),d2
  125.   MOVE.l  a7,(a0)+
  126.   MOVE.l  (a0),d3
  127.   MOVE.l  a7,(a0)+
  128.   MOVE.l  (a0),d4
  129.   MOVE.l  a7,(a0)+
  130.   MOVE.l  (a0),d5
  131.   MOVE.l  a7,(a0)+
  132.  
  133.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  134.   MOVE.w  d0,d4
  135.   SWAP  d4
  136.   MOVE.w  d4,d0
  137.   MOVE.w  d7,d4
  138.   MOVE.l  d5,d7
  139.   MOVE.w  d1,d5
  140.   SWAP  d5
  141.   MOVE.w  d5,d1
  142.   MOVE.w  d7,d5
  143.  
  144.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  145.   LSR.l #2,d7
  146.   EOR.l d0,d7
  147.   AND.l #$33333333,d7
  148.   EOR.l d7,d0
  149.   LSL.l #2,d7
  150.   EOR.l d7,d4
  151.   MOVE.l  d5,d7
  152.   LSR.l #2,d7
  153.   EOR.l d1,d7
  154.   AND.l #$33333333,d7
  155.   EOR.l d7,d1
  156.   LSL.l #2,d7
  157.   EOR.l d7,d5
  158.  
  159.   MOVE.l  (a0),a5
  160.   MOVE.l  a7,(a0)+
  161.   MOVE.l  (a0),a6
  162.   MOVE.l  a7,(a0)+
  163.  
  164.   EXG d4,a5
  165.   EXG d5,a6
  166.  
  167.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  168.   MOVE.w  d2,d4
  169.   SWAP  d4
  170.   MOVE.w  d4,d2
  171.   MOVE.w  d7,d4
  172.   MOVE.l  d5,d7
  173.   MOVE.w  d3,d5
  174.   SWAP  d5
  175.   MOVE.w  d5,d3
  176.   MOVE.w  d7,d5
  177.  
  178.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  179.   LSR.l #2,d7
  180.   EOR.l d2,d7
  181.   AND.l #$33333333,d7
  182.   EOR.l d7,d2
  183.   LSL.l #2,d7
  184.   EOR.l d7,d4
  185.   MOVE.l  d5,d7
  186.   LSR.l #2,d7
  187.   EOR.l d3,d7
  188.   AND.l #$33333333,d7
  189.   EOR.l d7,d3
  190.   LSL.l #2,d7
  191.   EOR.l d7,d5
  192.  
  193.   MOVE.l  d1,d7     ; Swap 4x1
  194.   LSR.l #4,d7
  195.   EOR.l d0,d7
  196.   AND.l #$0f0f0f0f,d7
  197.   EOR.l d7,d0
  198.   LSL.l #4,d7
  199.   EOR.l d7,d1
  200.   MOVE.l  d3,d7
  201.   LSR.l #4,d7
  202.   EOR.l d2,d7
  203.   AND.l #$0f0f0f0f,d7
  204.   EOR.l d7,d2
  205.   LSL.l #4,d7
  206.   EOR.l d7,d3
  207.  
  208.   BRA _start
  209. _x
  210.   MOVE.l  (a0),d0
  211.   MOVE.l  a7,(a0)+
  212.   MOVE.l  (a0),d1
  213.   MOVE.l  a7,(a0)+
  214.   MOVE.l  (a0),d2
  215.   MOVE.l  a7,(a0)+
  216.   MOVE.l  (a0),d3
  217.   MOVE.l  a7,(a0)+
  218.   MOVE.l  (a0),d4
  219.   MOVE.l  a7,(a0)+
  220.   MOVE.l  (a0),d5
  221.   MOVE.l  a7,(a0)+
  222.  
  223.   MOVE.l  a6,-c2pBPLSIZE(a1)
  224.  
  225.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  226.   MOVE.w  d0,d4
  227.   SWAP  d4
  228.   MOVE.w  d4,d0
  229.   MOVE.w  d7,d4
  230.   MOVE.l  d5,d7
  231.   MOVE.w  d1,d5
  232.   SWAP  d5
  233.   MOVE.w  d5,d1
  234.   MOVE.w  d7,d5
  235.  
  236.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  237.   LSR.l #2,d7
  238.   EOR.l d0,d7
  239.   AND.l #$33333333,d7
  240.   EOR.l d7,d0
  241.   LSL.l #2,d7
  242.   EOR.l d7,d4
  243.   MOVE.l  d5,d7
  244.   LSR.l #2,d7
  245.   EOR.l d1,d7
  246.   AND.l #$33333333,d7
  247.   EOR.l d7,d1
  248.   LSL.l #2,d7
  249.   EOR.l d7,d5
  250.  
  251.   MOVE.l  (a0),d7
  252.   MOVE.l  a7,(a0)+
  253.   MOVE.l  (a0),a6
  254.   MOVE.l  a7,(a0)+
  255.  
  256.   MOVE.l  a5,-c2pBPLSIZE(a2)
  257.  
  258.   MOVE.l  d7,a5
  259.   EXG d4,a5
  260.   EXG d5,a6
  261.  
  262.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  263.   MOVE.w  d2,d4
  264.   SWAP  d4
  265.   MOVE.w  d4,d2
  266.   MOVE.w  d7,d4
  267.   MOVE.l  d5,d7
  268.   MOVE.w  d3,d5
  269.   SWAP  d5
  270.   MOVE.w  d5,d3
  271.   MOVE.w  d7,d5
  272.  
  273.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  274.   MOVE.l  d6,(a2)+
  275.   LSR.l #2,d7
  276.   EOR.l d2,d7
  277.   AND.l #$33333333,d7
  278.   EOR.l d7,d2
  279.   LSL.l #2,d7
  280.   EOR.l d7,d4
  281.   MOVE.l  d5,d7
  282.   LSR.l #2,d7
  283.   EOR.l d3,d7
  284.   AND.l #$33333333,d7
  285.   EOR.l d7,d3
  286.   LSL.l #2,d7
  287.   EOR.l d7,d5
  288.  
  289.   MOVE.l  d1,d7     ; Swap 4x1
  290.   LSR.l #4,d7
  291.   EOR.l d0,d7
  292.   MOVE.l  a4,(a1)+
  293.   AND.l #$0f0f0f0f,d7
  294.   EOR.l d7,d0
  295.   LSL.l #4,d7
  296.   EOR.l d7,d1
  297.   MOVE.l  d3,d7
  298.   LSR.l #4,d7
  299.   EOR.l d2,d7
  300.   AND.l #$0f0f0f0f,d7
  301.   EOR.l d7,d2
  302.   LSL.l #4,d7
  303.   EOR.l d7,d3
  304. _start
  305.  
  306.   MOVE.l  d2,d7     ; Swap 8x2, part 1
  307.   LSR.l #8,d7
  308.   EOR.l d0,d7
  309.   AND.l #$00ff00ff,d7
  310.   EOR.l d7,d0
  311.   LSL.l #8,d7
  312.   EOR.l d7,d2
  313.   MOVE.l  d2,d7
  314.   LSR.l #1,d7     ; Swap 1x2, part 1
  315.   EOR.l d0,d7
  316.   AND.l #$55555555,d7
  317.   EOR.l d7,d0
  318.   MOVE.l  d0,c2pBPLSIZE*2(a2)
  319.   ADD.l d7,d7
  320.   EOR.l d7,d2
  321.   MOVE.l  d3,d7     ; Swap 8x2, part 2
  322.   LSR.l #8,d7
  323.   EOR.l d1,d7
  324.   AND.l #$00ff00ff,d7
  325.   EOR.l d7,d1
  326.   LSL.l #8,d7
  327.   EOR.l d7,d3
  328.   MOVE.l  d3,d7
  329.   LSR.l #1,d7     ; Swap 1x2, part 2
  330.   EOR.l d1,d7
  331.   AND.l #$55555555,d7
  332.   EOR.l d7,d1
  333.   MOVE.l  d1,c2pBPLSIZE*2(a1)
  334.   ADD.l d7,d7
  335.   EOR.l d7,d3
  336.  
  337.   MOVE.l  d5,d7
  338.   LSR.l #4,d7
  339.   EOR.l d4,d7
  340.   AND.l #$0f0f0f0f,d7
  341.   EOR.l d7,d4
  342.   LSL.l #4,d7
  343.   EOR.l d7,d5
  344.  
  345.   EXG d4,a5
  346.   EXG d5,a6
  347.  
  348.   MOVE.l  d5,d7
  349.   LSR.l #4,d7
  350.   EOR.l d4,d7
  351.   AND.l #$0f0f0f0f,d7
  352.   EOR.l d7,d4
  353.   LSL.l #4,d7
  354.   EOR.l d7,d5
  355.  
  356.   MOVE.l  a5,d0
  357.   MOVE.l  a6,d1
  358.   MOVE.l  d2,c2pBPLSIZE(a2)
  359.  
  360.   MOVE.l  d0,d7     ; Swap 8x2, part 3
  361.   LSR.l #8,d7
  362.   EOR.l d4,d7
  363.   AND.l #$00ff00ff,d7
  364.   EOR.l d7,d4
  365.   LSL.l #8,d7
  366.   EOR.l d7,d0
  367.   MOVE.l  d0,d7
  368.   LSR.l #1,d7     ; Swap 1x2, part 3
  369.   EOR.l d4,d7
  370.   AND.l #$55555555,d7
  371.   EOR.l d7,d4
  372.   ADD.l d7,d7
  373.   EOR.l d7,d0
  374.   MOVE.l  d1,d7     ; Swap 8x2, part 4
  375.   LSR.l #8,d7
  376.   MOVE.l  d3,c2pBPLSIZE(a1)
  377.   EOR.l d5,d7
  378.   AND.l #$00ff00ff,d7
  379.   EOR.l d7,d5
  380.   LSL.l #8,d7
  381.   EOR.l d7,d1
  382.   MOVE.l  d1,d7
  383.   LSR.l #1,d7     ; Swap 1x2, part 4
  384.   EOR.l d5,d7
  385.   AND.l #$55555555,d7
  386.   EOR.l d7,d5
  387.   ADD.l d7,d7
  388.   EOR.l d7,d1
  389.  
  390.   MOVE.l  d0,a5
  391.   MOVE.l  d1,a6
  392.  
  393.   MOVE.l  d4,d6
  394.   MOVE.l  d5,a4
  395.  
  396.   CMP.l a0,a3
  397.   BNE _x
  398.  
  399.   MOVE.l  a6,-c2pBPLSIZE(a1)
  400.   MOVE.l  a5,-c2pBPLSIZE(a2)
  401.   MOVE.l  d6,(a2)+
  402.   MOVE.l  a4,(a1)+
  403.   MOVE.l  stackstore(pc),a7
  404.   MOVEM.l (a7)+,a3-a6
  405. AsmExit
  406.  
  407.   Even4
  408. stackstore: Dc.l 0
  409. c2p_data
  410. c2p_scroffs: Dc.l 0
  411. c2p_pixels: Dc.l 0
  412.   Ds.l  16
  413.   Even4
  414. c2p_datanew
  415.   Ds.l  16
  416. End Statement
  417.  
  418. Statement chunkyshape1{A.l,B.l,C.l,D.l}
  419. .chunkyshape1
  420. ;any position masked with mask data and movement table
  421.   MOVEM.l a3-a6,-(a7)
  422.   MOVE.l  #objcount-1,d7 ; object loop
  423.   MOVE.l  d3,a3 ; base of table
  424.   MOVE.l  d0,a4 ; store
  425.   MOVE.l  d1,a5 ; store
  426.   MOVE.l  d2,a6 ; store
  427. objloop
  428.  
  429.   MOVEQ.l #0,d3
  430.   MOVE.w  (a3),d3
  431.   MOVEQ.l #0,d5
  432.   MOVEQ.l #0,d6
  433.   MOVE.w  4(a3),d5
  434.   MOVE.w  6(a3),d6
  435.   CMP.w   #6,d3 ; x<6?
  436.   BLE     xle
  437.   CMP.w   #scrwidth-objwidth-6,d3
  438.   BLT     xskip
  439. xle
  440.   EXG.l   d5,d6
  441. xskip
  442.   EXT.l   d5
  443.   ADD.l   d5,d3
  444.   MOVE.w  d3,(a3)
  445.   MOVE.w  d5,4(a3)
  446.   MOVE.w  d6,6(a3)
  447.  
  448.   MOVEQ.l #0,d4
  449.   MOVE.w  2(a3),d4
  450.   MOVEQ.l #0,d5
  451.   MOVEQ.l #0,d6
  452.   MOVE.w  8(a3),d5
  453.   MOVE.w  10(a3),d6
  454.   CMP.w   #6,d4 ; y<6?
  455.   BLE     yle
  456.   CMP.w   #scrheight-objheight-6,d4
  457.   BLT     yskip
  458. yle
  459.   EXG.l   d5,d6
  460. yskip
  461.   EXT.l   d5
  462.   ADD.l   d5,d4
  463.   MOVE.w  d4,2(a3)
  464.   MOVE.w  d5,8(a3)
  465.   MOVE.w  d6,10(a3)
  466.  
  467.   ADD.l   #12,a3
  468.   MULU    #scrwidth,d4
  469.   MOVE.l  a4,a0 ; input
  470.   ADD.l   d3,d4
  471.   MOVE.l  a5,a2 ; mask
  472.   MOVE.l  a6,d2
  473.   ADD.l   d4,d2 ; output
  474.   MOVE.l  d2,a1 ; output
  475.   MOVE.l  #objheight-1,d2
  476.   MOVE.l  #scrwidth-objwidth,d3
  477. ;Do masked blit
  478. yloop
  479.     MOVEQ.l #objlongwidth-1,d4
  480. xloop
  481.       MOVE.l  (a2)+,d0
  482.       AND.l   d0,(a1)
  483.       MOVE.l  (a0)+,d1
  484.       OR.l    d1,(a1)+
  485.       DBRA    d4,xloop
  486.     ADD.l   d3,a1
  487.     DBRA    d2,yloop
  488.   DBRA    d7,objloop
  489.   MOVEM.l (a7)+,a3-a6
  490. AsmExit
  491. End Statement
  492.  
  493. Statement chunkyshape2{A.l,B.l,C.l,D.l}
  494. .chunkyshape2
  495. ;any position masked with mask data and movement table
  496. ;B.l is unused in this routine
  497.   MOVEM.l a3-a6,-(a7)
  498.   MOVE.l  #objcount-1,d7 ; object loop
  499.   MOVE.l  d3,a3 ; base of table
  500.   MOVE.l  d0,a4 ; store
  501. ;  MOVE.l  d1,a5 ; store
  502.   MOVE.l  d2,a6 ; store
  503. objloop2
  504.  
  505.   MOVEQ.l #0,d3
  506.   MOVE.w  (a3),d3
  507.   MOVEQ.l #0,d5
  508.   MOVEQ.l #0,d6
  509.   MOVE.w  4(a3),d5
  510.   MOVE.w  6(a3),d6
  511.   CMP.w   #6,d3 ; x<6?
  512.   BLE     xle2
  513.   CMP.w   #scrwidth-objwidth-6,d3
  514.   BLT     xskip2
  515. xle2
  516.   EXG.l   d5,d6
  517. xskip2
  518.   EXT.l   d5
  519.   ADD.l   d5,d3
  520.   MOVE.w  d3,(a3)
  521.   MOVE.w  d5,4(a3)
  522.   MOVE.w  d6,6(a3)
  523.  
  524.   MOVEQ.l #0,d4
  525.   MOVE.w  2(a3),d4
  526.   MOVEQ.l #0,d5
  527.   MOVEQ.l #0,d6
  528.   MOVE.w  8(a3),d5
  529.   MOVE.w  10(a3),d6
  530.   CMP.w   #6,d4 ; y<6?
  531.   BLE     yle2
  532.   CMP.w   #scrheight-objheight-6,d4
  533.   BLT     yskip2
  534. yle2
  535.   EXG.l   d5,d6
  536. yskip2
  537.   EXT.l   d5
  538.   ADD.l   d5,d4
  539.   MOVE.w  d4,2(a3)
  540.   MOVE.w  d5,8(a3)
  541.   MOVE.w  d6,10(a3)
  542.  
  543.   ADD.l   #12,a3
  544.   MULU    #scrwidth,d4
  545.   MOVE.l  a4,a0 ; input
  546.   ADD.l   d3,d4
  547. ;  MOVE.l  a5,a2 ; mask
  548.   MOVE.l  a6,d2
  549.   ADD.l   d4,d2 ; output
  550.   MOVE.l  d2,a1 ; output
  551.   MOVE.l  #objheight-1,d2
  552.   MOVE.l  #scrwidth-objwidth,d3
  553. ;Do unmasked blit
  554. yloop2
  555.     MOVEQ.l #objlongwidth-1,d4
  556. xloop2
  557.       MOVE.l  (a0)+,(a1)+
  558.       DBRA    d4,xloop2
  559.     ADD.l   d3,a1
  560.     DBRA    d2,yloop2
  561.   DBRA    d7,objloop2
  562.   MOVEM.l (a7)+,a3-a6
  563. AsmExit
  564. End Statement
  565.  
  566. .blitzprogram
  567. ; Setup
  568. InitBank 1,#scrwidth*#scrheight,$10000 ; Fastram chunky buffer
  569. InitPalette 0,256
  570. For c=1 To 255
  571.   AGAPalRGB 0,c,(c/2)+Rnd(128),(c/2)+Rnd(128),(c/2)+Rnd(128)
  572. Next c
  573. AGAPalRGB 0,0,0,0,0
  574. VWait
  575. InitBank 0,(#scrwidth*Max(#planeheight,#c2pBPLY))+1000,2|65536 ; Chipram planar buffer
  576. CludgeBitMap 0,#scrwidth,Max(#planeheight,#c2pBPLY),8,Bank(0)
  577. Screen 0,0,0,#scrwidth,Max(#planeheight,#c2pBPLY),8,0,"c2p test",0,0,0
  578. Use Palette 0
  579. VWait 50
  580.  
  581. ; chunky shape
  582. InitBank 2,#objwidth*#objheight,$10000 ; chunky shape
  583. cstep.q=256/(#objwidth*#objheight)
  584. c.q=0
  585. For o.l=0 To (#objwidth*#objheight)-1
  586.   NPokeB Bank(2)+o,255-c
  587.   c+cstep
  588. Next o
  589. If #objmasking<>0
  590.   CacheClearU_
  591.   For o.l=0 To #objwidth*#objheight
  592.     p3.l=Bank(2)+Rnd(#objwidth*#objheight)-1
  593.     NPokeB p3,$00
  594.   Next o
  595. EndIf
  596.  
  597. ; chunky mask
  598. InitBank 3,#objwidth*#objheight,$10000 ; chunky mask
  599. For o.l=0 To (#objwidth*#objheight)-1
  600.   If NPeekB(Bank(2)+o)=0 Then NPokeB Bank(3)+o,$ff Else NPokeB Bank(3)+o,$0
  601. Next o
  602.  
  603. ; movement table
  604. InitBank 5,#objcount*12,$10000 ; table
  605. For o.l=0 To (#objcount-1)*12 Step 12
  606.   p1.w=6+Rnd(#scrwidth-#objwidth-14)
  607.   p2.w=6+Rnd(#scrheight-#objheight-14)
  608.   NPokeW Bank(5)+o,p1
  609.   NPokeW Bank(5)+o+2,p2
  610.   Repeat:xmove.w=Rnd(3)-Rnd(6):Until xmove<>0
  611.   Repeat:ymove.w=Rnd(3)-Rnd(6):Until ymove<>0
  612.   NPokeW Bank(5)+o+4,xmove
  613.   NPokeW Bank(5)+o+6,-xmove
  614.   NPokeW Bank(5)+o+8,ymove
  615.   NPokeW Bank(5)+o+10,-ymove
  616. Next o
  617.  
  618. ; Do the c2p test
  619. c2p040onlyinit{#scrwidth,#scrheight}
  620. CacheClearU_
  621. Forbid_
  622. VWait
  623. If #objmasking<>0
  624.   ResetTimer
  625.   For time=1 To #iterations
  626.     chunkyshape1{Bank(2),Bank(3),Bank(1),Bank(5)}
  627.     c2p040only{Bank(1),Bank(0)} ; Convert chunky to planar
  628.   Next time
  629.   t=Ticks
  630. Else
  631.   ResetTimer
  632.   For time=1 To #iterations
  633.     chunkyshape2{Bank(2),Bank(3),Bank(1),Bank(5)}
  634.     c2p040only{Bank(1),Bank(0)} ; Convert chunky to planar
  635.   Next time
  636.   t=Ticks
  637. EndIf
  638.  
  639. VWait 2 : Permit_
  640. VWait 20
  641. FindScreen 0
  642. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  643. WindowOutput 0
  644. per.f=1/(t/#iterations)
  645. NPrint "Routine performed @ ",50/(t/#iterations),"fps - ",t," ticks - ",per," per frame"
  646. NPrint " "
  647. NPrint "Press mousebutton..."
  648. Free Screen 0
  649. MouseWait
  650. Free Window 0
  651. End
  652.  
  653.